#ifndef PLANE_H
#define PLANE_H

#include "Vec3.h"
#include "LineSeg.h"

namespace Engine
{
	class Plane
	{
		private:
			Vec3 m_normal;
			float m_d;

			void Normalize();

		public:

			enum Pos 
			{
				BEHIND = -1, 
				IN_PLANE = 0, 
				IN_FRONT = 1
			};

			Plane():m_d(0.0f){}
			Plane(const Vec3& p0, const Vec3& p1, const Vec3& p2);
			void Set(const Vec3& p0, const Vec3& p1, const Vec3& p2);
			void SetABCD(float a, float b, float c, float d);
			float GetDistanceToPoint(const Vec3& point, Plane::Pos* p = nullptr) const;
			float GetDistanceToLineSeg(const LineSeg& line, Plane::Pos* p = nullptr) const;
			const Vec3& GetNormal() const{return m_normal;}
	};
}


#endif